﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;

namespace WebApplication1
{
    [DataContract]
    public class GoogleNewsResult: IGdiStoryData
    {
        const string HTML_TAG_PATTERN = "<.*?>";
        string _content;

        [DataMember]
        public string UnescapedUrl { get; set; }
        [DataMember]
        public string Url { get; set; }
        [DataMember]
        public string VisibleUrl { get; set; }
        [DataMember]
        public string TitleNoFormatting { get; set; }
        [DataMember]
        public string Content { get { return stripHTML(_content); } set { _content = value; } }
        [DataMember]
        public string Location { get; set; }
        [DataMember]
        public string ImageUrl{get; set;}
        [DataMember]
        public string PublishedDate { get; set; }

        static string stripHTML(string inputString)
        {
            return Regex.Replace
              (inputString, HTML_TAG_PATTERN, string.Empty);
        }
    }
}
